package pl.cvplus.entity;

import javax.persistence.*;
import java.sql.Date;
import java.util.Collection;

/**
 * Created by IntelliJ IDEA.
 * User: Piotrek
 * Date: 02.03.12
 * Time: 23:16
 * To change this template use File | Settings | File Templates.
 */
@javax.persistence.Table(name = "cp_cv", schema = "public", catalog = "")
@Entity
public class CpCv {
    private Integer id;

    @javax.persistence.Column(name = "id", nullable = false, insertable = true, updatable = true, length = 10, precision = 0)
    @Id
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    private Integer userFk;

    @javax.persistence.Column(name = "user_fk", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public Integer getUserFk() {
        return userFk;
    }

    public void setUserFk(Integer userFk) {
        this.userFk = userFk;
    }

    private Integer languageFk;

    @javax.persistence.Column(name = "language_fk", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public Integer getLanguageFk() {
        return languageFk;
    }

    public void setLanguageFk(Integer languageFk) {
        this.languageFk = languageFk;
    }

    private String firstname;

    @javax.persistence.Column(name = "firstname", nullable = true, insertable = true, updatable = true, length = 20, precision = 0)
    @Basic
    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    private String surname;

    @javax.persistence.Column(name = "surname", nullable = true, insertable = true, updatable = true, length = 30, precision = 0)
    @Basic
    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    private String country;

    @javax.persistence.Column(name = "country", nullable = true, insertable = true, updatable = true, length = 30, precision = 0)
    @Basic
    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    private String region;

    @javax.persistence.Column(name = "region", nullable = true, insertable = true, updatable = true, length = 30, precision = 0)
    @Basic
    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    private String city;

    @javax.persistence.Column(name = "city", nullable = true, insertable = true, updatable = true, length = 40, precision = 0)
    @Basic
    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    private String address;

    @javax.persistence.Column(name = "address", nullable = true, insertable = true, updatable = true, length = 100, precision = 0)
    @Basic
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    private String zip;

    @javax.persistence.Column(name = "zip", nullable = true, insertable = true, updatable = true, length = 6, precision = 0)
    @Basic
    public String getZip() {
        return zip;
    }

    public void setZip(String zip) {
        this.zip = zip;
    }

    private String postCity;

    @javax.persistence.Column(name = "post_city", nullable = true, insertable = true, updatable = true, length = 40, precision = 0)
    @Basic
    public String getPostCity() {
        return postCity;
    }

    public void setPostCity(String postCity) {
        this.postCity = postCity;
    }

    private String postCountry;

    @javax.persistence.Column(name = "post_country", nullable = true, insertable = true, updatable = true, length = 30, precision = 0)
    @Basic
    public String getPostCountry() {
        return postCountry;
    }

    public void setPostCountry(String postCountry) {
        this.postCountry = postCountry;
    }

    private String postRegion;

    @javax.persistence.Column(name = "post_region", nullable = true, insertable = true, updatable = true, length = 30, precision = 0)
    @Basic
    public String getPostRegion() {
        return postRegion;
    }

    public void setPostRegion(String postRegion) {
        this.postRegion = postRegion;
    }

    private String email;

    @javax.persistence.Column(name = "email", nullable = true, insertable = true, updatable = true, length = 50, precision = 0)
    @Basic
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    private String additionalEmail;

    @javax.persistence.Column(name = "additional_email", nullable = true, insertable = true, updatable = true, length = 50, precision = 0)
    @Basic
    public String getAdditionalEmail() {
        return additionalEmail;
    }

    public void setAdditionalEmail(String additionalEmail) {
        this.additionalEmail = additionalEmail;
    }

    private String phone;

    @javax.persistence.Column(name = "phone", nullable = true, insertable = true, updatable = true, length = 15, precision = 0)
    @Basic
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    private String additionalPhone;

    @javax.persistence.Column(name = "additional_phone", nullable = true, insertable = true, updatable = true, length = 15, precision = 0)
    @Basic
    public String getAdditionalPhone() {
        return additionalPhone;
    }

    public void setAdditionalPhone(String additionalPhone) {
        this.additionalPhone = additionalPhone;
    }

    private String about;

    @javax.persistence.Column(name = "about", nullable = true, insertable = true, updatable = true, length = 2147483647, precision = 0)
    @Basic
    public String getAbout() {
        return about;
    }

    public void setAbout(String about) {
        this.about = about;
    }

    private String hobbies;

    @javax.persistence.Column(name = "hobbies", nullable = true, insertable = true, updatable = true, length = 2147483647, precision = 0)
    @Basic
    public String getHobbies() {
        return hobbies;
    }

    public void setHobbies(String hobbies) {
        this.hobbies = hobbies;
    }

    private String additionalInfo;

    @javax.persistence.Column(name = "additional_info", nullable = true, insertable = true, updatable = true, length = 2147483647, precision = 0)
    @Basic
    public String getAdditionalInfo() {
        return additionalInfo;
    }

    public void setAdditionalInfo(String additionalInfo) {
        this.additionalInfo = additionalInfo;
    }

    private Integer styleFk;

    @javax.persistence.Column(name = "style_fk", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public Integer getStyleFk() {
        return styleFk;
    }

    public void setStyleFk(Integer styleFk) {
        this.styleFk = styleFk;
    }

    private Date birthdate;

    @javax.persistence.Column(name = "birthdate", nullable = true, insertable = true, updatable = true, length = 13, precision = 0)
    @Basic
    public Date getBirthdate() {
        return birthdate;
    }

    public void setBirthdate(Date birthdate) {
        this.birthdate = birthdate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CpCv cpCv = (CpCv) o;

        if (about != null ? !about.equals(cpCv.about) : cpCv.about != null) return false;
        if (additionalEmail != null ? !additionalEmail.equals(cpCv.additionalEmail) : cpCv.additionalEmail != null)
            return false;
        if (additionalInfo != null ? !additionalInfo.equals(cpCv.additionalInfo) : cpCv.additionalInfo != null)
            return false;
        if (additionalPhone != null ? !additionalPhone.equals(cpCv.additionalPhone) : cpCv.additionalPhone != null)
            return false;
        if (address != null ? !address.equals(cpCv.address) : cpCv.address != null) return false;
        if (birthdate != null ? !birthdate.equals(cpCv.birthdate) : cpCv.birthdate != null) return false;
        if (city != null ? !city.equals(cpCv.city) : cpCv.city != null) return false;
        if (country != null ? !country.equals(cpCv.country) : cpCv.country != null) return false;
        if (email != null ? !email.equals(cpCv.email) : cpCv.email != null) return false;
        if (firstname != null ? !firstname.equals(cpCv.firstname) : cpCv.firstname != null) return false;
        if (hobbies != null ? !hobbies.equals(cpCv.hobbies) : cpCv.hobbies != null) return false;
        if (id != null ? !id.equals(cpCv.id) : cpCv.id != null) return false;
        if (languageFk != null ? !languageFk.equals(cpCv.languageFk) : cpCv.languageFk != null) return false;
        if (phone != null ? !phone.equals(cpCv.phone) : cpCv.phone != null) return false;
        if (postCity != null ? !postCity.equals(cpCv.postCity) : cpCv.postCity != null) return false;
        if (postCountry != null ? !postCountry.equals(cpCv.postCountry) : cpCv.postCountry != null) return false;
        if (postRegion != null ? !postRegion.equals(cpCv.postRegion) : cpCv.postRegion != null) return false;
        if (region != null ? !region.equals(cpCv.region) : cpCv.region != null) return false;
        if (styleFk != null ? !styleFk.equals(cpCv.styleFk) : cpCv.styleFk != null) return false;
        if (surname != null ? !surname.equals(cpCv.surname) : cpCv.surname != null) return false;
        if (userFk != null ? !userFk.equals(cpCv.userFk) : cpCv.userFk != null) return false;
        if (zip != null ? !zip.equals(cpCv.zip) : cpCv.zip != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (userFk != null ? userFk.hashCode() : 0);
        result = 31 * result + (languageFk != null ? languageFk.hashCode() : 0);
        result = 31 * result + (firstname != null ? firstname.hashCode() : 0);
        result = 31 * result + (surname != null ? surname.hashCode() : 0);
        result = 31 * result + (country != null ? country.hashCode() : 0);
        result = 31 * result + (region != null ? region.hashCode() : 0);
        result = 31 * result + (city != null ? city.hashCode() : 0);
        result = 31 * result + (address != null ? address.hashCode() : 0);
        result = 31 * result + (zip != null ? zip.hashCode() : 0);
        result = 31 * result + (postCity != null ? postCity.hashCode() : 0);
        result = 31 * result + (postCountry != null ? postCountry.hashCode() : 0);
        result = 31 * result + (postRegion != null ? postRegion.hashCode() : 0);
        result = 31 * result + (email != null ? email.hashCode() : 0);
        result = 31 * result + (additionalEmail != null ? additionalEmail.hashCode() : 0);
        result = 31 * result + (phone != null ? phone.hashCode() : 0);
        result = 31 * result + (additionalPhone != null ? additionalPhone.hashCode() : 0);
        result = 31 * result + (about != null ? about.hashCode() : 0);
        result = 31 * result + (hobbies != null ? hobbies.hashCode() : 0);
        result = 31 * result + (additionalInfo != null ? additionalInfo.hashCode() : 0);
        result = 31 * result + (styleFk != null ? styleFk.hashCode() : 0);
        result = 31 * result + (birthdate != null ? birthdate.hashCode() : 0);
        return result;
    }

    private Collection<CpAnnex> cpAnnexesById;

    @OneToMany(mappedBy = "cpCvByCvFk")
    public Collection<CpAnnex> getCpAnnexesById() {
        return cpAnnexesById;
    }

    public void setCpAnnexesById(Collection<CpAnnex> cpAnnexesById) {
        this.cpAnnexesById = cpAnnexesById;
    }

    private CpLanguage cpLanguageByLanguageFk;

    @ManyToOne
    public
    @JoinColumn(name = "language_fk", referencedColumnName = "id")
    CpLanguage getCpLanguageByLanguageFk() {
        return cpLanguageByLanguageFk;
    }

    public void setCpLanguageByLanguageFk(CpLanguage cpLanguageByLanguageFk) {
        this.cpLanguageByLanguageFk = cpLanguageByLanguageFk;
    }

    private CpStyle cpStyleByStyleFk;

    @ManyToOne
    public
    @JoinColumn(name = "style_fk", referencedColumnName = "id")
    CpStyle getCpStyleByStyleFk() {
        return cpStyleByStyleFk;
    }

    public void setCpStyleByStyleFk(CpStyle cpStyleByStyleFk) {
        this.cpStyleByStyleFk = cpStyleByStyleFk;
    }

    private CpUser cpUserByUserFk;

    @ManyToOne
    public
    @JoinColumn(name = "user_fk", referencedColumnName = "id")
    CpUser getCpUserByUserFk() {
        return cpUserByUserFk;
    }

    public void setCpUserByUserFk(CpUser cpUserByUserFk) {
        this.cpUserByUserFk = cpUserByUserFk;
    }

    private Collection<CpEducation> cpEducationsById;

    @OneToMany(mappedBy = "cpCvByCvFk")
    public Collection<CpEducation> getCpEducationsById() {
        return cpEducationsById;
    }

    public void setCpEducationsById(Collection<CpEducation> cpEducationsById) {
        this.cpEducationsById = cpEducationsById;
    }

    private Collection<CpExperience> cpExperiencesById;

    @OneToMany(mappedBy = "cpCvByCvFk")
    public Collection<CpExperience> getCpExperiencesById() {
        return cpExperiencesById;
    }

    public void setCpExperiencesById(Collection<CpExperience> cpExperiencesById) {
        this.cpExperiencesById = cpExperiencesById;
    }

    private Collection<CpLanguageSkill> cpLanguageSkillsById;

    @OneToMany(mappedBy = "cpCvByCvFk")
    public Collection<CpLanguageSkill> getCpLanguageSkillsById() {
        return cpLanguageSkillsById;
    }

    public void setCpLanguageSkillsById(Collection<CpLanguageSkill> cpLanguageSkillsById) {
        this.cpLanguageSkillsById = cpLanguageSkillsById;
    }

    private Collection<CpMovie> cpMoviesById;

    @OneToMany(mappedBy = "cpCvByCvFk")
    public Collection<CpMovie> getCpMoviesById() {
        return cpMoviesById;
    }

    public void setCpMoviesById(Collection<CpMovie> cpMoviesById) {
        this.cpMoviesById = cpMoviesById;
    }
}
